package top.longmarch.flow.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;


/**
 * @author yuyue
 */
@Configuration
@EnableSwagger2WebMvc
public class Swagger2Configuration {


    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("组件化开发平台")
                        .description("# 组件化开发平台")
                        .termsOfServiceUrl("https://www.longmarch.top")
                        .contact(new Contact("Unidt", "https://www.longmarch.top", "yuyue_qty@163.com"))
                        .version("1.0")
                        .build())
                //分组名称
                .groupName("V1.0版本")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("top.longmarch.flow"))
                .paths(PathSelectors.any())
                .build();
    }

}